package org.edu.dao;


import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.edu.common.dao.BaseDao;
import org.edu.common.uiltst.RWxls;
import org.edu.model.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
//@Transactional(rollbackFor={RuntimeException.class},propagation=Propagation.REQUIRES_NEW)
public class DeptDao extends BaseDao<Dept, Integer>{
	@Autowired
	private TreeNodeDao treeNodeDao;

	public List<Dept> getXlsList() {
		// TODO Auto-generated method stub
		
//		System.out.println("dao调用");
//		System.out.println(DeptDao.class.getResource(File.separator + "FILE_NAME").getPath());
		List<Dept> list= new ArrayList<Dept>();
		try {
			List<String[]> result = RWxls.readXls("G:\\java3-Job\\HospitalM\\src\\main\\webapp\\xls\\部门信息表.xls",1);
			
			for(int i=0;i<result.size();i++){
				list.add(new Dept(result.get(i)));
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}
	
//	public void updataAll(List<Dept> dl,List<TreeNode> tl){
//		this.deleteAll(this.loadAll());
//		logger.info("已清空表》》》》》》》》》");
//		
//		for(int j=0;j<dl.size();j++){
//			logger.info("正在更新第"+j+"条");
//			treeNodeDao.save(tl.get(j));
//			this.save(dl.get(j));
//			if(j==5)  throw  new RuntimeException(); 
//		}
//	}
	
}
